/**
 *	\file
 *	\brief TODO represents a single class in the symbol table
 *
 *	A classElement is a object containing all the symbols used inside a class. It includes:
 *	\li class general information: whether it is abstract or static or both or none of those;
 *	\li its name;
 *	\li a list of its membership;
 *	\li its parent classes;
 *	\li its set of resources (functions, constants, variables);
 *
 * 	\date Aug 30, 2013
 * 	\author koldar
 */

#ifndef CLASSELEMENT_H_
#define CLASSELEMENT_H_

#include <stdbool.h>
#include "IdentifierList.h"
#include "ResourceHashTable.h"

/**represents a single class.
 *
 */
typedef struct ClassElement {
	char* name; //!< indicates the name of this class
	bool isAbstract; //!< TRUE if this class is abstract
	bool isStatic; //!< TRUE if this class is static
	PidentifierList groupList; //!< indicates a list of the access group this class is member of
	PidentifierList parentList; //!< indicates a list of parents classes
	ResourceHashTable resources; //!< indicates an hash table storing class resources
} ClassElement;

/**pointer to a ClassElement
 *
 */
typedef ClassElement* PclassElement;


/**construct a new ClassElement
 *
 * \post
 *  \li a new ClassElement is stored in memory. It can be freed with freeClassElement()
 *
 * @param _name the name of the newly created class
 * @param _isAbstract wether this class is abstract or not
 * @param _isStatic wether this class is static or not
 * @param _groupList a list of group this class is member of
 * @param _parentList a list of classes name which are configured to be parents of this class
 * @param _resources a set of resources owned by this class
 * @return a pointer to a ClassElement
 */
PclassElement initClassElement(char* _name, bool _isAbstract, bool _isStatic, PidentifierList _groupList, PidentifierList _parentList, ResourceHashTable _resources);

/**free a class Element
 *
 * \pre
 *  \li pobj not NULL
 * \post
 *  \li pobj is correctly deallocated from the memory
 *
 * @param pobj the object to be freed
 */
void freeClassElement(PclassElement pobj);

/**print a stirng representation of the class passed
 *
 * \pre
 *  \li f must be open in write mode
 * \post
 *  \li f is changed
 *
 * @param f the file to write the object on
 * @param pobj the object to be printed
 */
void printClassElement(FILE* f,PclassElement pobj);

#endif /* CLASSELEMENT_H_ */
